// RMSClientID.cpp: implementation of the CRMSClientID class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "rmsserver.h"
#include "RMSClientID.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CRMSClientID::CRMSClientID()
{

}

CRMSClientID::~CRMSClientID()
{

}

BOOL CRMSClientID::Initialize()
{
	for(int i = 0;  i<MAX_CLIENTS; i++)
	{
		m_bClients[i] = FALSE;
	}
	return TRUE;
}

BYTE CRMSClientID::GetClientID()
{
	for(int i=0; i<MAX_CLIENTS; i++)
	{
		if(!m_bClients[i])
		{
			m_bClients[i] = TRUE;
			return i+1;
		}
	}

	return 0;
}

BOOL CRMSClientID::ReleaseClientID(BYTE byClientID)
{
	m_bClients[byClientID] = FALSE;
	return TRUE;
}
